import pymysql

mydb = pymysql.connect(
    host='127.0.0.1',
    port=3306,
    user='root',
    passwd='123456'
)
print(mydb)
mycursor = mydb.cursor()
mycursor.execute("CREATE DATABASE mydatabase")